pow.ivyclient
Class BusIvy_

java.lang.Object
  extended by pow.ivyclient.BusIvy_

public class BusIvy_
extends java.lang.Object

inner representation of an ivy bus store the drones' information about the drones which belong to this ivy bus store the IP adress of the machine where the ivy bus is working


Constructor Summary
BusIvy_()
           
 
Method Summary
 void addDrones(int newDroneId)
          inform the bus that a new drone send information on this bus
 void displayDrones()
          display information on stdout about the drones present on the bus
 java.net.InetAddress getAddress()
          provides the IP adress of the host hosting the bus
 java.util.ArrayList<java.lang.Integer> getDrones()
          get a array list containing the ivy id of the drones present on the bus
 boolean isAlive()
          inform if the bus is alive
 boolean isOwnBy(int myDroneId)
          inform if a drone is present or not on the bus
 void setAddress(java.net.InetAddress myInetAddress)
           
 void updateTime()
          update the 'inner clock' of the object when a message for this bus is detected useful to know if the bus is still alive
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BusIvy_

public BusIvy_()
Method Detail

setAddress

public void setAddress(java.net.InetAddress myInetAddress)
Parameters:
myInetAddress - the ip address of the ivy host

updateTime

public void updateTime()
update the 'inner clock' of the object when a message for this bus is detected useful to know if the bus is still alive


addDrones

public void addDrones(int newDroneId)
inform the bus that a new drone send information on this bus

Parameters:
newDroneId - (the ivy id)

getDrones

public java.util.ArrayList<java.lang.Integer> getDrones()
get a array list containing the ivy id of the drones present on the bus

Returns:
the array list containing the ivy id of the drones present on the bus

displayDrones

public void displayDrones()
display information on stdout about the drones present on the bus


getAddress

public java.net.InetAddress getAddress()
provides the IP adress of the host hosting the bus

Returns:
the IP adress of the host hosting the bus

isOwnBy

public boolean isOwnBy(int myDroneId)
inform if a drone is present or not on the bus

Parameters:
myDroneId - the ivy id
Returns:
true if the drone is present on the bus

isAlive

public boolean isAlive()
inform if the bus is alive

Returns:
true if the last message was received less than 10 seconds ago